﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using itau.im.entidade;
using EnterpriseLibraryWrapper;
using System.Data;

namespace itau.im.dado
{
    public class TesteMockDB
    {
        public DataSet TesteExecuteDataSet()
        {
            IDataAccessWrapper data = EnterpriseLibraryFactory.GetDataAccess();
            data.ParameterIn.Add(new ParameterInWrapper("@Codigo", 1, DbType.Int32));
            data.ParameterIn.Add(new ParameterInWrapper("@Nome", "TESTE", DbType.AnsiStringFixedLength));

            return data.ExecuteDataSet("TESTE_EXECUTEDATASET");
        }

        public int TesteExecuteNonQuery()
        {
            IDataAccessWrapper data = EnterpriseLibraryFactory.GetDataAccess();
            data.ParameterIn.Add(new ParameterInWrapper("@Codigo", 1, DbType.Int32));
            data.ParameterIn.Add(new ParameterInWrapper("@Nome", "TESTE", DbType.AnsiStringFixedLength));

            return data.ExecuteNonQuery("TESTE_EXECUTENONQUERY");
        }

        public object TesteExecuteScalar()
        {
            IDataAccessWrapper data = EnterpriseLibraryFactory.GetDataAccess();
            data.ParameterIn.Add(new ParameterInWrapper("@Codigo", 1, DbType.Int32));
            data.ParameterIn.Add(new ParameterInWrapper("@Nome", "TESTE", DbType.AnsiStringFixedLength));

            return data.ExecuteScalar("TESTE_EXECUTESCALAR");
        }

        public int TesteExecuteNonQueryParameterOut()
        {
            IDataAccessWrapper data = EnterpriseLibraryFactory.GetDataAccess();
            data.ParameterIn.Add(new ParameterInWrapper("@Codigo", 1, DbType.Int32));
            data.ParameterIn.Add(new ParameterInWrapper("@Nome", "TESTE", DbType.AnsiStringFixedLength));
            data.ParameterOut.Add(new ParameterOutWrapper("@CodigoResultado", DbType.AnsiStringFixedLength, 0));

            return data.ExecuteNonQuery("TESTE_EXECUTENONQUERY2");
        }

        public IDataReader TesteExecuteReader()
        {
            IDataAccessWrapper data = EnterpriseLibraryFactory.GetDataAccess();
            data.ParameterIn.Add(new ParameterInWrapper("@Codigo", 1, DbType.Int32));
            data.ParameterIn.Add(new ParameterInWrapper("@Nome", "TESTE", DbType.AnsiStringFixedLength));

            return data.ExecuteReader("TESTE_EXECUTEDATASET");
        }


    }
}
